import { Get, Inject, Provide, Query } from '@midwayjs/core';
import {
  CoolController,
  BaseController,
  CoolUrlTag,
  TagTypes,
  CoolTag,
} from '@cool-midway/core';
import { HelpInfoService } from '../../service/info';

/**
 * 帮助信息
 */
@Provide()
@CoolController()
@CoolUrlTag()
export class AppHelpInfoController extends BaseController {
  @Inject()
  helpInfoService: HelpInfoService;

  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Get('/helpCenter', { summary: '获取帮助中心信息' })
  async getHelpCenter() {
    return this.ok(await this.helpInfoService.getByType(1));
  }

  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Get('/privacyPolicy', { summary: '获取隐私保护说明' })
  async getPrivacyPolicy() {
    return this.ok(await this.helpInfoService.getByType(2));
  }

  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Get('/aboutUs', { summary: '获取关于我们信息' })
  async getAboutUs() {
    return this.ok(await this.helpInfoService.getByType(3));
  }

  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Get('/getAllTypes', { summary: '获取所有类型的帮助信息' })
  async getAllTypes() {
    return this.ok(await this.helpInfoService.getAllTypes());
  }

  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Get('/detail', { summary: '获取帮助信息详情' })
  async getDetail(@Query('id') id: number) {
    return this.ok(await this.helpInfoService.getDetail(id));
  }
}